package com.zero;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Person p1 = new Person();
        p1.name = "王五";
        System.out.println(p1.name);
        Person p2 = new Person("张三");
        p2.name = "詹金森";
        System.out.println(p2.name);
        Person p3 = new Person("李四",23);
        System.out.println(p3.name + p3.age);

        Male mal1 = new Male();
        mal1.work = "擦皮鞋";
        mal1.name = "滴答";
        mal1.age = 24;
        System.out.println(mal1.work + mal1.name + mal1.age);
        mal1.Test001();

        Male mal2 = new Male("haha",23,"ceshi");
        System.out.println(mal2.work + mal2.name + mal2.age);

        C c = new C();
        c.printAInfo();
        c.printBInfo();

    }
    //继承
    public static class Person {
        public String name;
        public int age;

        public Person() {
            System.out.println("我咋是一个黑户？");
        }
        public Person(String name) {
            this.name = name;
            System.out.println("我叫"+name+",我几岁了？");
        }
        public Person(String name,int age) {
            this.name = name;
            this.age = age;
            System.out.println("我叫" + name + ",我" + age +"岁了！");
        }
        public void sleeping() {
            System.out.println("人开始睡觉了~");
        }

    }

    public static class Male extends Person {
        private String work;
        public Male() {
            System.out.println("我是一个失业人员");
        }
        public Male(String name,int age, String work) {
            this.name = name;
            this.age = age;
            this.work = work;
        }
        public void sleeping() {
            System.out.println("男人开始睡觉了~");
        }
        //this调用本身 super调用父类
        public void Test001() {
            this.sleeping();
            super.sleeping();
        }


    }

    //多继承
    public interface A {
        public void printAInfo();
    }

    public interface B {
        public void printBInfo();
    }


    public static class C implements A,B {

        @Override
        public void printAInfo() {
            System.out.println("我来自A哦");
        }

        @Override
        public void printBInfo() {
            System.out.println("我来自B哦");
        }


    }


}
